<<<<<<< HEAD
// var mysql      = require('mysql');
// var connection = mysql.createConnection({
//   host     : 'localhost',
//   user     : 'root',
//   password : '577926hc',
//   database : 'juzao',
//   connectTimeout: 6000,
//   multipleStatements: true
// });
// connection.connect();

// module.exports = (sql) => {
//   return new Promise(next => {
//     // connection.connect();
//     connection.query(sql, function (error, results, fields) {
//       if (error) throw error;
//       // console.log('The solution is: ', rows[0].solution);
//       next(results)
//     });
//     // connection.end();
//   })

// }


var mysql = require('mysql');
var connection = mysql.createConnection({
    host: 'localhost',
    port: 3306,
    user: 'root',
    password : '577926hc',
    database : 'juzao',
});
connection.connect();
module.exports = (sql) => {
    return new Promise(next => {
        
        connection.query(sql, function (error, results, fields) {
            if(error) throw error;
            //console.log('The solution is:', results[0].solution);
            next(results)
        });
        // connection.end();
    })
}
=======

var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'root',
  password : '577926',
  database : 'juzao',
  connectTimeout: 6000,
  multipleStatements: true
});
 
connection.connect();
module.exports = (sql) => {
  return new Promise(next => {
    connection.query(sql, function (error, results, fields) {
      // console.log(results)
      if (error) throw error;
      // console.log('The solution is: ', results[0].solution);
      next(results)
    });
  
  // connection.end();
  })


}
  
>>>>>>> 88e39a9 (完善)
